<template>
	<view>
		<view class="goods-list" v-for="(item,key) in list" @click="toinfo(item)">
			<view class="goods-info">
				<text class="title">{{item.name}}</text>
				<text class="sale">库存{{item.number}}件</text>
				<view class="price">
					<view class="btn">优惠后 ￥{{item.price}}</view><text class="market-price">￥{{item.market_price}}</text>
				</view>
			</view>
			<u-icon name="arrow-right"></u-icon>
		</view>
	</view>
</template>
<style lang="scss">
	.goods-list{
		display: flex;
		flex-direction: row;
		background-color: #FFFFFF;
		padding: 24rpx;
		
		margin: 18rpx;
		border-radius: 10rpx;
		.goods-info{
			display: flex;
			flex-direction: column;
			flex: 1;
			.title{
				font-size: 32rpx;
			}
			.sale{
				font-size: 24rpx; color:#666666; margin: 24rpx 0;
			}
			.price{
				height: 50rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				.btn{
					background-color: #ed3f14;
					color: #FFFFFF;
					padding: 0 24rpx;
					line-height: 50rpx;
					height: 50rpx;
					font-size: 24rpx;
					border-radius: 26rpx;
				}
				.market-price{
					font-size: 24rpx;
					color: #666666;
					text-decoration: line-through;
					margin-left: 24rpx;
				}
			}
			
		}
	}
</style>
<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad(options){
			this.$u.http.get("mall/goods/list",{
				keyword:options.keyword
			}).then(res => {
				console.log(res);
				this.list = res.data.list;
			})
		},
		methods: {
			toinfo(item){
				uni.navigateTo({
					url:"/pages/mall/info?id=" + item.id
				})
			}
		}
	}
</script>

<style>

</style>
